<?php

namespace App\Http\Controllers;

use App\Models\Setting;
use Illuminate\Http\Request;

class InviteController extends Controller
{
    public function index(Request $request)
    {
        $uuid = $request->get('code');
        $cid = $request->get('cid');
        $group = $request->get('group', 0);
        $invites = Setting::get('invites');
        $appName = Setting::get('app_name');
        $downloadLink = $invites['download_app_url'];
        if (empty($downloadLink)) {
            $downloadLink = $invites['local_download_url'] ?? '';
        }

        return view('invite', [
            'app_name' => $appName,
            'download_app_url' => $downloadLink,
            'ulinkid' => $invites['ulinkid'],
            'uuid' => $uuid,
            'cid' => $cid,
            'group_invite' => $group,
        ]);
    }
}
